{extend name="public:layout" /}
{block name="title"}集采申请管理{/block}
{block name="head"}{/block}
{block name="body"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> 集采申请列表</li>
            </ol>
        </div>
        <div class="ibox-content">
            <div class="toolbar">
                <div class="pull-right">
                    <form class="form-inline" method="post">
                        <div class="form-group">
                            <select class="form-control" name="searchKey">
                                <option value="class_name" {eq name="query.searchKey" value="class_name"}selected{/eq}>集采分类</option>
                                <option value="goods_name" {eq name="query.searchKey" value="goods_name"}selected{/eq}>商品名称</option>
                                <option value="goods_name" {eq name="query.searchKey" value="site_name"}selected{/eq}>店铺名称</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <div class="input-group">
                                <input class="form-control" name="searchName" type="text" value="{$query.searchName}" placeholder="检索关键词">
                            </div>
                        </div>
                        <button type="submit" class="btn btn-info">
                            <i class="fa fa-search"></i> 搜索
                        </button>
                        <a class="btn btn-white" href="{:url('index')}">
                            <i class="fa fa-trash"></i> 清空
                        </a>
                    </form>
                </div>
                <div class="clearfix"></div>
            </div>
            <ul class="nav nav-tabs" id="tab_search">
                <li {eq name="query.jicai_status" value="0"}class="active"{/eq}><a href="{:url('index',['jicai_status'=>0])}">待审核集采商品</a></li>
                <li {eq name="query.jicai_status" value="1"}class="active"{/eq}><a href="{:url('index',['jicai_status'=>1])}">正在集采商品</a></li>
                <li {eq name="query.jicai_status" value="2"}class="active"{/eq}><a href="{:url('index',['jicai_status'=>2])}">即将开始集采</a></li>
                <li {eq name="query.jicai_status" value="3"}class="active"{/eq}><a href="{:url('index',['jicai_status'=>3])}">已结束集采</a></li>
            </ul>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th width="50">#</th>
                    <th width="80">分类名称</th>
                    <th width="160">店铺名称</th>
                    <th>商品名称</th>
                    <th>产品缩略图</th>
                    <th>集采价格</th>
                    <th>集采销量</th>
                    <th>集采总量</th>
                    <th>点击量</th>
                    <th>是否推荐</th>
                    <th width="220">操作</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="vo"}
                <tr>
                    <td>{$vo.jicai_id}</td>
                    <td>{$vo.class_name}</td>
                    <td>{$vo.goods_name}</td>
                    <td>{$vo.site_name}</td>
                    <td>
                        <img src="{$vo.goods_thumb|default='/public/nopic.gif'}" width="40" height="30" />
                    </td>
                    <td>{$vo.jicai_price}</td>
                    <td>{$vo.jicai_sale}</td>
                    <td>{$vo.jicai_stock}</td>
                    <td>{$vo.jicai_hits}</td>
                    <td>{$vo.jicai_commend==1?是:不推荐}</td>
                    <td>
                        <a href="{:url('commend',['jicai_id'=>$vo['jicai_id'],'jicai_commend'=>$vo['jicai_commend']])}" {eq name="query.jicai_status" value="0"}style="display:none;"{/eq}>{eq name="vo.jicai_commend" value="0"}推荐{else/}取消推荐{/eq}</a>
                        <a href="javascript:;" onclick="pass(this);" data-jicaiid="{$vo.jicai_id}" {gt name="query.jicai_status" value="0"}style="display:none;"{/gt}>通过</a>
                        <a href="javascript:;" onclick="doAction(this);"
                           data-msg="确认删除吗？" data-url="{:url('del')}" data-params="jicai_id={$vo.jicai_id}"> &nbsp;删除</a>
                    </td>
                </tr>
                {/volist}
                </tbody>
            </table>

            <div class="clearfix"></div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    In('layer',function () {
        $('.showDetail').click(function () {
            layer.tips($(this).data('tips'), this, {
                tips: [1, '#3595CC'],
                time: 3000
            });
        });
    })
    //通过审核
    function pass(obj){
        var jicaiid = $(obj).data('jicaiid');
        getAjax('{:url("pass")}',{jicaiid:jicaiid},function (res) {
            if(res.code ==1){
                layer.msg(res.msg);
                $(obj).closest('tr').remove();
            }
        })
    }
</script>
{/block}